const fs = require('fs');

const file = 'C:/Users/LT/Desktop/2.txt';

fs.readFile(file, (err, data) => {
  if (err) throw new Error(err);
  const tempArr = data.toString().split('\r\n');
  const dataArr = tempArr.slice(1, tempArr.length - 1);
  let sucaiSum = 0;
  let mobanSum = 0;
  let svgSum = 0;
  const dataArrLen = dataArr.length;
  console.log(dataArr, dataArrLen, dataArrLen * 5);
  for (let i = 0; i < dataArrLen; i++) {
    const [sucai, moban, svg = '0'] = dataArr[i].split('---');
    // console.log(sucai, moban, svg);
    sucaiSum += parseInt(sucai);
    mobanSum += parseInt(moban);
    svgSum += parseInt(svg);
  }
  console.log('sucaiSum: ', sucaiSum);
  console.log('mobanSum: ', mobanSum);
  console.log('svgSum: ', svgSum);
});
// SPECIFIC WORK COMPLETION WORK EXPERIENCE AND GAINS
// const urls = [
//   '/private/v1/api/user/login',
//   '/private/v1/api/user/register'
// ]

// const urls2 = [
//   /\/login$/,
//   /\/register$/
// ]

// function func(url){
//   return urls.findi(item => item == url);
// }

// function func2(url){
//   return urls2.findi(item => url.match(item)) == -1;
// }

// console.log(func2('/private/v1/api/user/logins'))
